package com.czy.fx.day1.pane.Box;

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class demo1 extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("标题");
        primaryStage.setWidth(800);
        primaryStage.setHeight(800);
        AnchorPane anchorPane = new AnchorPane();
        primaryStage.setScene(new Scene(anchorPane));

        anchorPane.setStyle("-fx-background-color: #EE1169");



        //水平布局
        //HBox box = new HBox();
        //垂直布局
        VBox box = new VBox();
        box.setPrefWidth(500);
        box.setPrefHeight(100);
        box.setStyle("-fx-background-color: #27EE11FF");
        anchorPane.getChildren().add(box);

        Button b1 = new Button("b1");
        Button b2 = new Button("b2");
        Button b3 = new Button("b3");
        Button b4 = new Button("b4");
        Button b5 = new Button("b5");

        box.getChildren().addAll(b1, b2, b3, b4, b5);
        //子控件居中
        box.setAlignment(Pos.CENTER);
        //响应式布局 管理子组件的位置，设置上边界距离
        primaryStage.show();
    }
}
